<template>
  <div class="card" @click="cardClick">
    <span :class="['card__icon','fa', 'fa-' + card.img]" aria-hidden="true"></span>
    <h3 class="card__title">{{card.title}}</h3>
    <p class="card__body">
      {{card.body}}
    </p>
  </div>
</template>

<script>
  export default {
    name: 's-card',
    props: {
      card: {
        type: Object,
        require: true,
      },
    },
    methods: {
      cardClick () {
        this.$emit('cardClick', this.card);
      },
    },
  };
</script>

<style scoped lang="scss">
  .card {
    float: left;
    border-radius: 3px;
    box-shadow: 0 2px 10px 1px rgba(0, 0, 0, .1);
    height: 110px;
    width: 300px;
    margin: 15px;
    padding: 25px;
    position: relative;
    vertical-align: top;
    transition: .4s;
    cursor: pointer;
    &:hover {
      box-shadow: 0 10px 20px 1px rgba(0, 0, 0, .1);
      text-decoration: none;
    }
  }

  .card__icon {
    font-size: 24px;
    left: 28px;
    position: absolute;
    top: 25px;
    color: #20a0ff;
  }

  .card__title {
    color: #20a0ff;
    margin-top: 0;
    margin-bottom: 10px;
    margin-left: 40px;
  }

  .card__body {
    line-height: 22px;
    margin-left: 40px;
  }

  @media screen and (max-width: 800px) {
    .card {
      width: calc(100% - 80px);
    }
  }
</style>
